package cn.smile.dao.admin;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import cn.smile.entity.admin.User;

/**
 * 用户数据库处理层
 */
@SuppressWarnings("JpaQlInspection")
@Repository
public interface UserDao extends JpaRepository<User, Long> {

    /**
     * 按照用户名查找用户信息
     */
    User findByUsername(String username);

    /**
     * 根据用户id查询
     */
    @Query("select u from User u where id = :id")
    User find(@Param("id") Long id);

}
